package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IAllticketsService;
import cn.wolfcode.trip.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("allticketeses")
public class AllticketsContrroller {

    @Autowired
    private IAllticketsService allticketsService;

    /**
     * 所有的买票的信息
     *
     * @return
     */
    @RequestMapping("list")
    public String listAll(@ModelAttribute("qo") QueryObject qo, Model model) {
        model.addAttribute("pageInfo", allticketsService.query(qo));
        return "/alltickets/list";
    }

    @RequestMapping("delete")
    @ResponseBody
    public JSONResult delete(Long id) {
        allticketsService.delete(id);
        return new JSONResult();
    }
}
